﻿using MesApiSimulator.Objects;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;

namespace MesApiSimulator.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class SysController : ControllerBase
    {
        /// <summary>
        /// 获取产品型号列表数据接口（接口ID：600）
        /// </summary>
        /// <returns></returns>
        [HttpPost(nameof(GetMiList))]
        public ActionResult GetMiList(GetMiListArgs args)
        {
            GetMiListResult result = new();
            return Ok(result);
        }

        /// <summary>
        /// 获取生产批次（工单号）数组接口（接口ID：605）
        /// </summary>
        /// <returns></returns>
        [HttpPost(nameof(GetBatchNos))]
        public ActionResult GetBatchNos(GetBatchNosArgs args)
        {
            GetBatchNosResult result = new();
            return Ok(result);
        }

        /// <summary>
        /// 上传设备报警
        /// </summary>
        /// <returns></returns>
        [HttpPost(nameof(UploadWarnStatus))]
        public ActionResult UploadWarnStatus(UploadWarnStatusArgs args)
        {
            string json = System.Text.Json.JsonSerializer.Serialize(args);
            Debug.WriteLine($"{DateTime.Now}：上报报警");
            Debug.WriteLine(json);
            return Ok(new UploadWarnStatusResult());
        }
    }
}
